/**
 * Copyright:Copyright(c)2014-2017
 * Company:厦门市易致达物联网科技有限公司
 * @version 1.0
 */
package shop.services.front.voucher.dao.impl;

import java.util.List;

import shop.core.common.dao.BaseDao;
import shop.core.common.dao.page.PagerModel;
import shop.services.front.voucher.bean.Voucher;
import shop.services.front.voucher.dao.VoucherDao;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * @类名称：VoucherDaoImpl
 * @创建人：wzl
 * @创建时间：2018-01-03 下午16:55:48  
 * @版本号：1.0
 * @描述：
 */
@Repository("voucherDaoFront")
public class VoucherDaoImpl  implements VoucherDao {

    @Resource
    private BaseDao dao;

    public void setDao(BaseDao dao) {
        this.dao = dao;
    }

    public PagerModel selectPageList(Voucher e) {
        return dao.selectPageList("front.voucher.selectPageList","front.voucher.selectPageCount", e);
    }

    public List selectList(Voucher e) {
        return dao.selectList("front.voucher.selectList", e);
    }

    public Voucher selectOne(Voucher e) {
        return (Voucher) dao.selectOne("front.voucher.selectOne", e);
    }

    public int delete(Voucher e) {
        return dao.delete("front.voucher.delete", e);
    }

    public int update(Voucher e) {
        return dao.update("front.voucher.update", e);
    }

    public int deletes(String[] ids) {
        Voucher e = new Voucher();
        for (int i = 0; i < ids.length; i++) {
            e.setId(ids[i]);
            delete(e);
        }
        return 0;
    }

    public int insert(Voucher e) {
        return dao.insert("front.voucher.insert", e);
    }

    public int deleteById(int id) {
        return dao.delete("front.voucher.deleteById", id);
    }

    @Override
    public Voucher selectById(String id) {
        return (Voucher) dao.selectOne("front.voucher.selectById", id);
    }

    @Override
    public List<Voucher> selectVoucherList(Voucher voucher) {
        return dao.selectList("front.voucher.selectVoucherList", voucher);
    }
}

